import importlib
import os

import settings


def load_pkg_modules(path):
    modules = os.walk(path)
    for path, dirs, files in modules:
        for file in files:
            if file.endswith("py"):
                module = path.replace(settings.PROJECT_PATH, "").replace(os.sep, ".").strip(".") + "." + file.strip(
                    ".py")
                yield importlib.import_module(module)
